package com.gopay.common.autowithdraw;

import java.util.HashMap;
import java.util.Map;

/**
 * 自动提现周期类型
 * @author LEI XIAOBAO
 * @2015-09-09
 */
public enum CycleType {

	  /** 0：每天 */
    AW_DAY("0"),
    /** 1：每周 */
    AW_WEEK("1"),
    /** 2：每月 */
    AW_MONTH("2"),
    /** 3:默认    */
    AW_DEFAULT("3");

    public final String value;
	private static Map<String, Object> map = new HashMap<String, Object>();
	private static Map<String, Object> distinctMap = new HashMap<String, Object>();

	static {
		map.put("0", "每日");
		map.put("1", "每周");
		map.put("2", "每月");
		map.put("3", "每日");
		
		distinctMap.put("0", "每日");
		distinctMap.put("1", "每周");
		distinctMap.put("2", "每月");
	}
	
    CycleType(String value) {
        this.value = value;
    }

    /**
     * 根据枚举类型的字符串值 获取 相应的枚举变量
     */
    public static CycleType get(String str) {
    	CycleType[] cs = CycleType.class.getEnumConstants();
        for (CycleType c : cs) {
            if (c.toString().equals(str)){
                return c;
            }
        }
        throw new RuntimeException(" wrong " + CycleType.class.getSimpleName() + " string value! " + str);
    }

    /**
     * 获取自动提现周期
     * @return
     */
    public static Map<String, Object> getCycleTypeOptions(){
    	return map;
    }
    
    @Override
    public String toString() {
        return value;
    }

	public static Map<String, Object> getDistinctCycleTypeOptions() {
		return distinctMap;
	}
}
